<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加导航</title>
    <style>
        .head {
            margin-bottom: 20px;
            padding-top: 14rpx;
            border-bottom: #7e7c7c 0.5px dotted;
        }
        .logo {
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .logo-icon {
            width: 32px;
            height: 32px;
        }
        .logo-text {
            display: flex;
            flex-direction: column;
        }
        .logo-title {
            font-size: 18px;
            font-weight: bold;
            color: #333;
        }
        .logo-subtitle {
            font-size: 12px;
            color: #666;
            margin-top: 2px;
        }
        body {
            width: 320px;
            padding: 16px;
            margin: 0;
            font-family: system-ui, -apple-system, sans-serif;
        }

        .form-group {
            margin-bottom: 12px;
        }

        label {
            display: block;
            margin-bottom: 4px;
            font-size: 14px;
            color: #333;
        }

        input {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
        }

        .btn {
            width: 100%;
            padding: 8px;
            background: #5b95f2;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
        }

        .btn:hover {
            background: #2f76e7;
        }

        select {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 1rem;
            outline: none;
            cursor: pointer;
            transition: all 0.2s;
        }
        .modal {
            display: none;
        }
        .input-group {
            display: flex;
            align-items: center;
            flex-direction: row;
            margin-bottom: 8rpx;
        }
        .btn-group {
            display: flex;
            align-items: center;
            flex-direction: row;
            padding: 12rpx;
            margin-top: 10rpx;
            /* 右对齐 */
            justify-content: flex-end;
        }
        .input-cancel-btn {
            padding: 8px;
            background: #5b95f2;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
            margin-right: 1rem;
        }
        .input-confirm-btn {
            padding: 8px;
            background: #f12409;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
        }
    </style>
</head>

<body>
    <div class="head">
        <div class="logo">
            <div>
                <img src="assets/icon.png" class="logo-icon" alt="QuickNav Logo">
            </div>
            <div class="logo-text">
                <span class="logo-title">QuickNav</span>
                <span class="logo-subtitle">快速导航效果工具</span>
            </div>
        </div>
    </div>
    <form id="addToolForm">
        <div class="form-group">
            <label for="title">标题</label>
            <input type="text" id="title" name="title" required>
        </div>
        <div class="form-group">
            <label for="url">网址</label>
            <input type="url" id="url" name="url" required>
        </div>
        <div class="form-group">
            <label for="description">描述</label>
            <input type="text" id="description" name="description" required>
        </div>
        <div class="form-group">
            <label for="icon">图标</label>
            <input type="text" id="icon" name="icon" required>
        </div>
        <div class="form-group">
            <label for="sort">排序(值越大，越排在前面)</label>
            <input type="number" id="sort" name="icon" value="0" required>
        </div>
        <div class="form-group">
            <label for="category">分类</label>
            <div id="categoryModal" class="modal">
                <div class="modal-content">
                    <div class="input-group">
                        <input type="text" id="newCategoryInput" placeholder="请输入新分类名称">
                    </div>
                    
                    <div class="btn-group">
                        <div class="input-cancel-btn" id="cancelCategory">取消</div>
                        <div class="input-confirm-btn" id="confirmCategory">确认</div>
                    </div>
                </div>
            </div>
            <!-- <input type="text" id="category" name="category" required> -->
            <select id="category" name="category" data-custom="allow" required>
                <!-- ${getCategories().map(c => `<option value="${c}">${c}</option>`).join('')} -->
            </select>
        </div>
        <button type="submit" class="btn" id="add-nav-btn">添加到导航</button>
    </form>
    
    <script src="js/toast.js"></script>
    <script src="js/kv.js"></script>
    <script src="js/popup.js"></script>
</body>

</html>